package cn.jee.cs.model;

import javax.persistence.*;

@Entity
public class CourseStudent {
    @EmbeddedId
    CourseStudentId id;
    @Column(name = "score")
    Float score;
    @ManyToOne
    @MapsId("courseId")
    Course course;
    @ManyToOne
    @MapsId("studentId")
    Student student;

    public CourseStudent(){}

    public CourseStudent(Course course, Student student,Integer year) {
        this.course = course;
        this.student = student;
        this.id = new CourseStudentId(course.getId(),student.getId(),year);
    }

    public CourseStudentId getId() {
        return id;
    }

    public void setId(CourseStudentId id) {
        this.id = id;
    }

    public Float getScore() {
        return score;
    }

    public void setScore(Float score) {
        this.score = score;
    }

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }
}
